$OpenBSD: patch-source_tools_pdfshow_c,v 1.3 2016/12/12 10:54:39 sthen Exp $

add pledge(2) to "mutool show":
  - rpath : dropped after opening
  - no need of wpath cpath for -o, as the open is already done at this place

--- source/tools/pdfshow.c.orig	Mon Nov 28 13:34:04 2016
+++ source/tools/pdfshow.c	Mon Dec 12 09:39:02 2016
@@ -220,6 +220,12 @@ int pdfshow_main(int argc, char **argv)
 	char *output = NULL;
 	int c;
 
+	if (pledge("stdio rpath", NULL) == -1)
+	{
+		fprintf(stderr, "pledge: %s\n", strerror(errno));
+		exit(1);
+	}
+
 	ctx = fz_new_context(NULL, NULL, FZ_STORE_UNLIMITED);
 	if (!ctx)
 	{
@@ -253,6 +259,13 @@ int pdfshow_main(int argc, char **argv)
 	fz_try(ctx)
 	{
 		doc = pdf_open_document(ctx, filename);
+		
+		if (pledge("stdio", NULL) == -1)
+		{
+			fprintf(stderr, "pledge: %s\n", strerror(errno));
+			exit(1);
+		}
+
 		if (pdf_needs_password(ctx, doc))
 			if (!pdf_authenticate_password(ctx, doc, password))
 				fz_warn(ctx, "cannot authenticate password: %s", filename);
